import request from '@/utils/request'

// 创建通用树
export function createCommonTree(data) {
  return request({
    url: '/sa/common-tree/create',
    method: 'post',
    data: data
  })
}

// 更新通用树
export function updateCommonTree(data) {
  return request({
    url: '/sa/common-tree/update',
    method: 'put',
    data: data
  })
}

// 更新通用树
export function changeStatus(id,status) {
  let data={
    id: id,
    status: status
  }
  return request({
    url: '/sa/common-tree/update',
    method: 'put',
    data: data
  })
}

// 删除通用树
export function deleteCommonTree(id) {
  return request({
    url: '/sa/common-tree/delete?id=' + id,
    method: 'delete'
  })
}

// 获得通用树
export function getCommonTree(id) {
  return request({
    url: '/sa/common-tree/get?id=' + id,
    method: 'get'
  })
}
// 获得通用树
export function getChildren(id) {
  return request({
    url: '/sa/common-tree/children?id=' + id,
    method: 'get'
  })
}

// 获得通用树分页
export function getCommonTreePage(query) {
  return request({
    url: '/sa/common-tree/page',
    method: 'get',
    params: query
  })
}
// 获得通用树分页
export function getCommonTreeList(query) {
  return request({
    url: '/sa/common-tree/all',
    method: 'get',
    params: query
  })
}

// 导出通用树 Excel
export function exportCommonTreeExcel(query) {
  return request({
    url: '/sa/common-tree/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
